LQCD @ PASC23

Sam Foreman

2023-06-05

Generative Modeling & Efficient Sampling

2023-06-29 @ PASC23

Sam Foreman
saforem2/lqcd-pasc23

Testing Callouts

Note

Testing callouts with simple appearance

Standard Model

  • Electricity & Magnetism
  • Quantum Field Theory
    • Nuclear interactions
      • Strong + Weak Force
      • Observed particles
    • Quantum Chromodynamics (QCD):
      • Quark / gluon interactions in the nuclueus
      • Analytical progress is difficult1
        • Lattice QCD to the rescue! 🚀

Magnetic Moment of the Muon

\(a_{\mu} = \frac{(g_{\mu} - 2)}{2}\)

Can Lattice QCD resolve this?
new physics??

Muon \(g-2\)

Testing

Hamiltonian Monte Carlo (HMC)

  • Idea: We can evolve the \((\dot{x}, \dot{v})\) system to get new states \(\\{x_{i}\\}\)

  • Write the Joint distribution \(p(x, v)\): \[p(x, v) = p(x) p(v) \propto e^{-S[x]} e^{-\frac{1}{2}v^{T} v} = e^{-H(x, v)}\]

Hamiltonian Dynamics: \[\begin{align} \dot{x} &= +\partial_{v} H\\ \dot{v} &= -\partial_{x} H \end{align}\]

Overview

Code
import numpy as np
x = np.random.rand()
print(x)
0.23466511284265967

Columns

Left column

Right column

Python

For a demonstration of a line plot on a polar axis, see Figure 1

import numpy as np
import matplotlib.pyplot as plt

plt.rcParams.update({
    'axes.facecolor': 'none',
    'figure.facecolor': 'none',
    'savefig.facecolor': 'none',
    'savefig.format': 'svg',
    'axes.edgecolor': 'none',
    'axes.grid': True,
    'axes.labelcolor': '#666',
    'axes.titlecolor': '#666',
    'grid.color': '#666',
    'text.color': '#666',
    'grid.linestyle': '--',
    'grid.linewidth': 0.5,
    'grid.alpha': 0.4,
    'xtick.color': 'none',
    'ytick.color': 'none',
    'xtick.labelcolor': '#666',
    'legend.edgecolor': 'none',
    'ytick.labelcolor': '#666',
    'savefig.transparent': True,
})

r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r
fix, ax = plt.subplots(
    subplot_kw = {'projection': 'polar'}
)
assert isinstance(ax, plt.PolarAxes)
ax.plot(theta, r)
ax.set_rticks([0.5, 1., 1.5, 2.])
ax.grid(True)
plt.show()

Python

Figure 1: A line plot on a polar axis

Figures with Subcaptions

import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()

plt.plot([8,65,23,90])
plt.show()

(a) First

(b) Second

Figure 2: Charts

Mermaid Diagrams

flowchart TB
  A --> C
  A --> D
  B --> C
  B --> D

Mermaid Example

flowchart LR
  markdown["`This **is** _Markdown_`"]
  newLines["`Line1
  Line 2
  Line 3`"]
  markdown --> newLines

Block Layout

List One

  • Item A
  • Item B
  • Item C

List Two

  • Item X
  • Item Y
  • Item Z

Placing Colorbars

Colorbars indicate the quantitative extent of image data. Placing in a figure is non-trivial because room needs to be made for them. The simplest case is just attaching a colorbar to each axes:

import matplotlib.pyplot as plt
import numpy as np

fig, axs = plt.subplots(2, 2)
assert isinstance(fig, plt.Figure)
cmaps = ['RdBu_r', 'viridis']
for col in range(2):
    for row in range(2):
        ax = axs[row, col]
        pcm = ax.pcolormesh(
          np.random.random((20, 20)) * (col + 1),
          cmap=cmaps[col]
        )
        fig.colorbar(pcm, ax=ax)
ax.grid(False)
plt.show()

Placing Colorbars

Figure 3: ?(caption)

Model Parallel Training: Example

\[ y = w_0 * x_0 + w_1 * x_1 + w_2 * x_2 \]

  1. Compute \(y_{0} = w_{0} * x_{0}\) and send to \(\longrightarrow\) GPU1
  2. Compute \(y_{1} = y_{0} + w_{1} * x_{1}\) and send to \(\longrightarrow\) GPU2
  3. Compute \(y = y_{1} * w_{2} * x_{2}\)
flowchart LR
  subgraph X0["GPU0"]
    direction LR
    a["w0"]
  'end'
  subgraph X1["GPU1"]
    direction LR
    b["w1"]
  'end'
  subgraph X2["GPU2"]
    direction LR
    c["w2"]
  'end'
  X1 & X0 <--> X2
  X0 <--> X1
  x["x0, x1, x2"] --> X0

Extras

Default

Note that there are six types of callouts, including: default, primary, success, info, and warning, and danger

Primary

Info

Success

Warning!

Danger!

Extras

  • Testing lists
  • Testing
    • Testing
    • Testing again
      • triple Checkboxes
    • Nested lists
      • TODOs
      • Checkboxes ??

Thank you!